import _axios from './axios';
import Vue from 'vue'
import get from 'lodash.get';
// const baseUrl = '/api';

const directory = '/api/rating'
const API = {
    /**
     * 判断手机号是否为员工手机号
     * @param {Object} data
     * @param {string} mobile
     */
    getMemberMobileCheck(data) {
        return _axios({
            method: 'GET',
            url: directory + '/member/mobileCheck',
            params: {
                ...data,
            }
        })
    },
    /**
     * 发送验证码
     * @param {Object} data
     * @param {string} mobile
     */
    getSmsSend(data) {
        return _axios({
            method: 'GET',
            url: '/api/sms/send',
            params: {
                event: "mobilelogin",
                ...data,
            }
        })
    },
    /**
     * 手机号登陆
     * @param {Object} data
     * @param {string} mobile
     * @param {string} captcha 
     */
    getMemberMobilelogin(data) {
        return _axios({
            method: 'GET',
            url: directory + '/member/mobilelogin',
            params: {
                ...data,
            }
        })
    },
    /**
     * 用户信息
     */
    getMemberInfo() {
        return _axios({
            method: 'GET',
            url: directory + '/member/info',
            params: {
                token: localStorage.getItem('token'),
                
            }
        })
    },
    /**
     * 任务列表
     */
    getTaskIndex(data) {
        return _axios({
            method: 'GET',
            url: directory + '/task/index',
            params: {
                token: localStorage.getItem('token'),
                ...data
            }
        })
    },
    /**
     * 评分
     * @param {string} taskId
     * @param {string} rate
     */
    getTaskRate(data) {
        return _axios({
            method: 'GET',
            url: directory + '/task/rate',
            params: {
                token: localStorage.getItem('token'),
                
                ...data
            }
        })
    },
    /**
     * 关于
     * @param {*} data 
     */
    getArticletIndex(data){
        return _axios({
            method: 'GET',
            url: directory + '/article/index',
            params: {
                token: localStorage.getItem('token'),
                ...data
            }
        })
    }
    // get/api/rating.article/index
}
var $ = {
    install(Vue) {
        Vue.prototype.API = API
    }
}

Vue.use($);
export default API